<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta nickname="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        //使用var定义的变量或方法，都会默认成为window的属性之一
        // var age = 20
        // console.log(window);

        let obj = {
            nickname: "Simba",
            age: 20,
            introduceSelf() {
                console.log(`你好，我叫${this.nickname},今年${this.age}岁了`);
            }
        }

        let ace = {
            nickname: "Ace",
            age: 30,
            introduceSelf: obj.introduceSelf
        }

        obj.introduceSelf()
        ace.introduceSelf()

        let zz = obj.introduceSelf
        zz()


    </script>
</body>

</html>